<%@ page contentType="text/html;charset=UTF-8" pageEncoding="utf8" language="java" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf8">
    <title><spring:message code="label.title"/></title>
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/bootstrap/css/bootstrap.min.css"/>"/>
    <script src="<c:url value='/resources/bootstrap/js/bootstrap.min.js'/>"></script>
    <script src="<c:url value='/resources/scripts/jquery.min.js'/>"></script>
</head>
<body>
<%@include file="/WEB-INF/views/header.jsp" %>

<div class="panel panel-default">
    <div class="panel-heading">
        <h1><spring:message code="label.registration.title"/></h1>
    </div>

    <div class="panel-body">
        <c:if test="${not empty error}">
            <div class="alert alert-danger text-center">${error}</div>
        </c:if>

        <form:form action="${pageContext.request.contextPath}/register" commandName="user" method="POST" enctype="utf8"
                   role="form">
            <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

            <div class="form-group">
                <label for="user-firstName" class="col-sm-2 control-label"><spring:message
                        code="label.user.firstName"/></label>

                <div class="col-sm-10">
                    <div class="form-group">
                        <form:errors id="error-firstName" path="firstName" for="user-firstName"
                                     cssClass="control-label"/>
                        <form:input id="user-firstName" path="firstName" cssClass="form-control"
                                    placeholder="First Name"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="user-lastName" class="col-sm-2 control-label"><spring:message
                        code="label.user.lastName"/></label>

                <div class="col-sm-10">
                    <div class="form-group">
                        <form:errors id="error-lastName" path="lastName" for="user-lastName"
                                     cssClass="control-label"/>
                        <form:input id="user-lastName" path="lastName" cssClass="form-control"
                                    placeholder="Last Name"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="user-email" class="col-sm-2 control-label"><spring:message
                        code="label.user.email"/></label>

                <div class="col-sm-10">
                    <div class="form-group">
                        <form:errors id="error-email" path="email" for="user-email"
                                     cssClass="control-label"/>
                        <form:input id="user-email" path="email" cssClass="form-control"
                                    placeholder="Email"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="user-password" class="col-sm-2 control-label"><spring:message
                        code="label.user.password"/></label>

                <div class="col-sm-10">
                    <div class="form-group">
                        <form:errors id="error-password" path="password" for="user-password"
                                     cssClass="control-label"/>
                        <form:password id="user-password" path="password" cssClass="form-control"
                                    placeholder="Password"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="user-passwordVerification" class="col-sm-2 control-label"><spring:message
                        code="label.user.passwordVerification"/></label>

                <div class="col-sm-10">
                    <div class="form-group">
                        <form:errors id="error-passwordVerification" path="passwordVerification"
                                     for="user-passwordVerification"
                                     cssClass="control-label"/>
                        <form:password id="user-passwordVerification" path="passwordVerification" cssClass="form-control"
                                    placeholder="Password Verification"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default"><spring:message
                            code="label.registration.submit"/></button>
                </div>
            </div>

            <%--<div class="row">--%>
            <%--<div id="form-group-firstName" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-firstName"><spring:message--%>
            <%--code="label.user.firstName"/>:</label>--%>
            <%--<form:input id="user-firstName" path="firstName" cssClass="form-control"/>--%>
            <%--<form:errors id="error-firstName" path="firstName" cssClass="help-block"/>--%>
            <%--</div>--%>
            <%--</div>--%>
            <%--<div class="row">--%>
            <%--<div id="form-group-lastName" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-lastName"><spring:message--%>
            <%--code="label.user.lastName"/>:</label>--%>
            <%--<form:input id="user-lastName" path="lastName" cssClass="form-control"/>--%>
            <%--<form:errors id="error-lastName" path="lastName" cssClass="help-block"/>--%>
            <%--</div>--%>
            <%--</div>--%>
            <%--<div class="row">--%>
            <%--<div id="form-group-email" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-email"><spring:message code="label.user.email"/>:</label>--%>
            <%--<form:input id="user-email" path="email" cssClass="form-control"/>--%>
            <%--<form:errors id="error-email" path="email" cssClass="help-block"/>--%>
            <%--</div>--%>
            <%--</div>--%>
            <%--<div class="row">--%>
            <%--<div id="form-group-password" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-password"><spring:message--%>
            <%--code="label.user.password"/>:</label>--%>
            <%--<form:password id="user-password" path="password" cssClass="form-control"/>--%>
            <%--<form:errors id="error-password" path="password" cssClass="help-block"/>--%>
            <%--</div>--%>
            <%--</div>--%>
            <%--<div class="row">--%>
            <%--<div id="form-group-passwordVerification" class="form-group col-lg-4">--%>
            <%--<label class="control-label" for="user-passwordVerification"><spring:message--%>
            <%--code="label.user.passwordVerification"/>:</label>--%>
            <%--<form:password id="user-passwordVerification" path="passwordVerification"--%>
            <%--cssClass="form-control"/>--%>
            <%--<form:errors id="error-passwordVerification" path="passwordVerification"--%>
            <%--cssClass="help-block"/>--%>
            <%--</div>--%>
            <%--</div>--%>
            <%--<button type="submit" class="btn btn-default"><spring:message--%>
            <%--code="label.registration.submit"/></button>--%>
        </form:form>
    </div>
</div>
</body>
</html>
